//
// Created by 魏延龙 on 2020/7/29.
// Copyright (c) 2020 魏延龙. All rights reserved.
//

#import "SlideNavigationView.h"

@interface SlideNavigationView ()
@property(nonatomic, strong) UIButton *leftBtn;
@property(nonatomic, strong) UILabel *titleLabel;
@property(nonatomic, strong) UIView *containerView;
@end

@implementation SlideNavigationView

- (instancetype)init {
    if (self = [super init]) {
        [self setupViews];
    }
    return self;
}

- (void)layoutSubviews {
    self.leftBtn.frame = CGRectMake(15, self.frame.size.height - 20 - 12, 20, 20);
    self.titleLabel.frame = CGRectMake(30, self.frame.size.height - 22 - 10, self.frame.size.width - 60, 22);
    self.containerView.frame = self.bounds;
}

- (void)setupViews {

    self.containerView = [[UIView alloc] init];
    {
        self.containerView.backgroundColor = [UIColor whiteColor];
        [self addSubview:self.containerView];
    }

    self.leftBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    {
        [self addSubview:self.leftBtn];
    }

    self.titleLabel = [[UILabel alloc] init];
    {
        self.titleLabel.text = self.title;
        self.titleLabel.textColor = [UIColor blackColor];
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        self.titleLabel.font = [UIFont fontWithName:@"PingFangTC-Medium" size:16];
        [self addSubview:self.titleLabel];
    }
}

#pragma mark --public

- (void)setTitle:(NSString *)title {
    _title = title;
    self.titleLabel.text = title;
}

- (void)setContainerViewAlpha:(CGFloat)containerViewAlpha {
    _containerViewAlpha = containerViewAlpha;
    self.containerView.alpha = containerViewAlpha;
}
- (void)setViewAlpha:(CGFloat)viewAlpha {
    _viewAlpha = viewAlpha;
    self.alpha = viewAlpha;
}


@end
